<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        @keyframes typing {
            from {
                width: 0
            }
        }

        @keyframes caret {
            50% {
                border-color: transparent;
            }
        }

        h1 {
            width: 15ch;
            /* 文本的宽度 */
            overflow: hidden;
            white-space: nowrap;
            border-right: .05em solid;
            animation: typing 6s steps(15),
                caret 1s steps(1) infinite;
        }
    </style>
</head>

<body>
    <h1>CSS is awesome!</h1>
</body>

</html>